package com.dc2013.followme;

import java.util.ArrayList;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.dc2013.adapter.LikeAdapter;
import com.dc2013.followme.RefreshableListView.OnRefreshListener;

import android.opengl.Visibility;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class ListUploaded_Activity extends SherlockActivity
{

	private ActionBar actionbar;
	private View customActionbar_layout;
	private TextView Actionbar_title;
	private RefreshableListView uploadedList;
	private ImageItem imageItem;
	private ArrayList<ImageItem> uploaded_item_arrayList;
	private LikeAdapter likeAdapter;
	private LayoutInflater inflater;
	private LinearLayout actionbarMenu;
	private View view_for_click;
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_list_uploaded);
		
		actionbar = getSupportActionBar();
		inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		
		//액션바 설정 부분
		
		customActionbar_layout = inflater.inflate(R.layout.actionbar_layout,null);
		Actionbar_title = (TextView)customActionbar_layout.findViewById(R.id.actionbar_title);
		actionbarMenu = (LinearLayout)findViewById(R.id.actionbar_menu);
		view_for_click = (View)findViewById(R.id.view_for_click);
		
		
		//액션바 메뉴 설정
		Actionbar_title.setText("내가 올린 사진들");
		Actionbar_title.setOnClickListener(actionbarClick);
		view_for_click.setOnClickListener(viewClick);
		
		
		actionbar.setCustomView(customActionbar_layout,
				new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT,
						ActionBar.LayoutParams.MATCH_PARENT));
		actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
		
		
		// 리스트뷰 설정부분
		
		uploaded_item_arrayList = new ArrayList<ImageItem>();
    //  여기서 아이템 추가 
	//	imageItem = new ImageItem(imageUrl, subjectName, subjectId, isLiked, numberofLike, numberofComment)
		
		uploaded_item_arrayList.add(imageItem);
		
		uploadedList = (RefreshableListView)findViewById(R.id.upload_list);
			
		
		likeAdapter = new LikeAdapter(this,R.layout.list_type,uploaded_item_arrayList);
		uploadedList.setAdapter(likeAdapter);

		// pull to refresh 리스너
		uploadedList.setOnRefreshListener(new OnRefreshListener() 
		{
			
			@Override
			public void onRefresh(RefreshableListView listView) 
			{
				// TODO Auto-generated method stub
				
			}
		});

	}
	
	private OnClickListener actionbarClick = new OnClickListener() 
	{
		
		@Override
		public void onClick(View v) 
		{
			actionbarMenu.setVisibility(View.VISIBLE);
			view_for_click.setVisibility(View.VISIBLE);

		}
	};
	
	private OnClickListener viewClick = new OnClickListener() 
	{
		
		@Override
		public void onClick(View v) 
		{
			actionbarMenu.setVisibility(View.GONE);
			view_for_click.setVisibility(View.GONE);
			
		}
	};



	
}
